import React from 'react'
import '../assets/css/reg.less'
class Reg extends React.Component{
    constructor(){
        super();
         this.state={
            title:"账号注册",
            userInfo:{
                loginName:"admin",
                passWord:"1234"
            }
         }

    }
    loginNameChange(e){
        console.log(e.target.value);
        this.setState({userInfo:{...this.state.userInfo,loginName:e.target.value}})
    }
    passWordChange(e){
        this.setState({userInfo:{...this.state.userInfo,passWord:e.target.value}})
    }
    submit(){
        console.log("注册");

        console.log(this.state.userInfo);
    }
    setValue(){
        this.setState({userInfo:{loginName:"zs",passWord:"123456"}})
    }
    render(){
      return <div className='reg-body'>
        <div>{this.state.title}</div>
        <div>{this.state.userInfo.loginName}</div>

        <div>账号 <input value={this.state.userInfo.loginName} onChange={(e)=>this.loginNameChange(e)} type="text" /></div>
        <div>密码 <input value={this.state.userInfo.passWord} onChange={(e)=>this.passWordChange(e)}  type="text" /></div>
         <div>

         <button onClick={()=>this.setValue()}>回显</button>
            
            <button onClick={()=>this.submit()}>注册</button>
         
         </div>
      </div>
    }
}
export default Reg;